package com.ldc.common.net;

import com.ldc.common.model.BaseModel;
import com.ldc.common.model.LoginInfoModel;
import com.ldc.common.model.RegisterInfoModel;

import io.reactivex.Observable;
import io.reactivex.Single;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface CommonServer {
    //登录
    @POST(value = "/user/login")
    Single<BaseModel<LoginInfoModel>> login(@Query("username") String username,
                                            @Query("password") String password);

    //注册
    @POST(value = "/user/register")
    Observable<BaseModel<RegisterInfoModel>> register(
            @Query(value = "username") final String username,
            @Query(value = "password") final String password,
            @Query(value = "repassword") final String password2);

    //收藏文章
    @POST(value = "/lg/collect/{id}/json")
    Observable<BaseModel<Object>> selectCollect(@Path(value = "id") String id);


    //取消收藏
    @POST(value = "/lg/uncollect_originId/{id}/json")
    Observable<BaseModel<Object>> unSelectCollect(@Path(value = "id") String id);

    //我的收藏取消收藏
    @POST(value = "/lg/uncollect/{id}/json")
    Observable<BaseModel<Object>> unSelectCollectOriginId(@Path(value = "id") String id, @Query(value = "originId") String originId);

}
